/*
 * Amaze - QT downloader for the Amazon MP3 store
 * Copyright (c) 2010-2011 Robert Keevil
 *
 * This program is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <QVBoxLayout>
#include <QFile>
#include <QTextStream>
#include "license.h"

License::License(QDialog *parent) :
    QDialog(parent)
{
    this->setWindowTitle(tr("License"));
    resize(QSize(640, 480));

    edt_format = new QTextEdit();
    btn_close = new QPushButton(tr("Close"));
    connect(btn_close, SIGNAL(clicked()), this, SLOT(accept()));

    edt_format->setReadOnly(true);
    QFile inputFile(":/COPYING");
    inputFile.open(QIODevice::ReadOnly);
    QTextStream in(&inputFile);
    edt_format->setPlainText(in.readAll());
    inputFile.close();

    QVBoxLayout *layout = new QVBoxLayout;
    layout->setMargin(0);
    layout->addWidget(edt_format);
    layout->addWidget(btn_close);

    setLayout(layout);
}
